
import java.util.Scanner;

class Vehicle {

    private float price;
    private int minute;
    public Vehicle() {
    }
    public Vehicle(float price, int minute) {
        this.price= price;
        this.minute = minute;
    }

    public float getPrice() {
        return price;
    }
    public void setPrice(float price) {
        this.price = price;
    }
    public int getMinute() {
        return minute;
    }
    public void setMinute(int minute) {
        this.minute = minute;
    }
    public float computeFee(){
        return 20.0f*minute/60;
    }
}

class Car extends Vehicle{
    Car(float price, int minute){
        super(price,minute);
    }
    public float computeFee(){
        double sum = 0;
        int time = getMinute();
        int hour = time/60;
        time%=60;
        if(time>30)
        {
            hour++;
        }

        return getPrice()*hour;
    }
}

class Bus extends Vehicle{
    private int seats;
    Bus() {
    }
    Bus(float price, int minute,int seats){
        super(price,minute);
        this.seats = seats;
    }

    public int getSeats() {
        return seats;
    }

    public void setSeats(int seats) {
        this.seats = seats;
    }

    public float computeFee(){
        double sum = 0;
        int time = getMinute();
        int hour = time/60;
        time%=60;
        if(time>30) {
            hour++;
        }
        else if(time>0) {
            return getPrice()*hour+0.5f*getPrice();
        }

        return getPrice()*hour;
    }
}


public class Main1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Car c = new Car(4,78);
        c.setPrice(sc.nextFloat());
        c.setMinute(sc.nextInt());
        System.out.printf("Car fee:%.2f\n",c.computeFee());
        Bus b = new Bus();
        b.setPrice(sc.nextFloat());
        b.setMinute(sc.nextInt());
        b.setSeats(sc.nextInt());
        System.out.printf("Bus seats:%d,fee:%.2f\n",b.getSeats(),b.computeFee());
    }
}
/* 请在这里填写答案 编写Car类和Bus类  */